# Maintainer: Maxim Baz <$pkgname at maximbaz dot com>
# Maintainer: Frederik Schwan <freswa at archlinux dot org>
# Contributor: Alad Wenter <alad@archlinux.org>
# Contributor: Jelle van der Waa <jelle@vdwaa.nl>
# Contributor: Chris Salzberg <chris@dejimata.com>
# Contributor: Leonidas Spyropoulos <artafinde@gmail.com>
pkgname=neomutt
pkgver=20231103
pkgrel=1
pkgdesc='A version of mutt with added features'
url='https://neomutt.org/'
license=('GPL')
arch=('loong64' 'x86_64')
depends=('glibc' 'gpgme' 'lua53' 'notmuch-runtime' 'krb5' 'gnutls' 'sqlite'
         'libsasl' 'ncurses' 'libidn2' 'lmdb' 'gdbm' 'kyotocabinet'
         'lz4' 'zlib' 'zstd')
optdepends=('python: keybase.py'
            'perl: smime_keys'
            'ca-certificates: default CA certificates')
makedepends=('git' 'gnupg' 'libxslt' 'docbook-xsl' 'w3m')
_github='https://github.com/neomutt/neomutt'
source=("$pkgname-$pkgver.tar.gz::$_github/archive/$pkgver.tar.gz"
        "$pkgname-$pkgver.tar.gz.sig::$_github/releases/download/$pkgver/$pkgver.tar.gz.sig"
        "default-ca-certificates.patch")
sha256sums=('d8712c8f852f1cae4d5f53d8f7db3d2cc7ce7a11f54df3fc6e5417995d02bae8'
            'SKIP'
            '571716b8979e9b43328416c3c56eff228b6c58355d7c080b8987ea89c6360776')
validpgpkeys=('86C2397270DD7A561263CA4E5FAF0A6EE7371805') # Richard Russon (flatcap) <rich@flatcap.org>

prepare() {
    cd "$pkgname-$pkgver"
    patch -Np1 -i ../default-ca-certificates.patch
}

build() {
    cd "$pkgname-$pkgver"
    ./configure \
        --prefix=/usr \
        --sysconfdir=/etc \
        --libexecdir=/usr/lib \
        --gpgme \
        --sqlite \
        --autocrypt \
        --lua \
        --notmuch \
        --gss \
        --gnutls \
        --sasl \
        --with-ui=ncurses \
        --with-idn2=/usr \
        --disable-idn \
        --idn2 \
        --lmdb \
        --kyotocabinet \
        --gdbm \
        --ubsan \
        --lz4 \
        --zlib \
        --zstd
    make
}

package() {
    cd "$pkgname-$pkgver"
    make DESTDIR="$pkgdir" install
}
